package biscuit.data;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/*
 * 방
 * 
 * 방 번호(리스트로 외부 처리)
 * 방 제목
 * 참여자 리스트
 * 문서 변경 히스토리(리스트)
 * 대화 히스토리(리스트)
 */
public class Room {

	private int index;
	private String title;
	private List<User> userList;
	private List<Document> docuHistory;
	private List<Chat> chatHistory;

	public Room(String title, User firstUser) {
		// 변수 초기화
		this.title = title;
		this.userList = Collections.synchronizedList(new ArrayList<User>());
		this.userList.add(firstUser);
		this.docuHistory = Collections.synchronizedList(new ArrayList<Document>());
		this.chatHistory = Collections.synchronizedList(new ArrayList<Chat>());
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public String getTitle() {
		return title;
	}

	public List<User> getUserList() {
		return userList;
	}

	public User getUser(int index) {
		return userList.get(index);
	}

	public int getUserSize() {
		return userList.size();
	}

	public List<Document> getDocuHistory() {
		return docuHistory;
	}

	public Document getDocuHistory(int index) {
		return docuHistory.get(index);
	}

	public List<Chat> getChatHistory() {
		return chatHistory;
	}

	public Chat getChatHistory(int index) {
		return chatHistory.get(index);
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public void addUser(User user) {
		this.userList.add(user);
	}

	public void addDocument(Document document) {
		this.docuHistory.add(document);
	}

	public void addChat(Chat chat) {
		this.chatHistory.add(chat);
	}

}
